package com.atguigu.cloud.apis;

import com.atguigu.cloud.entities.PayDTO;
import com.atguigu.cloud.rest.ResultData;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author HanYiMing
 * @description
 * @date 2024/3/20
 * @lastEditDate 2024/3/20
 * @lastEditAuthor
 * @lastDescription
 */
//@FeignClient(value = "cloud-payment-service")
@FeignClient(value = "cloud-gateway")
public interface PayFeignApi {

    /**
     * @param payDTO
     * @return
     * @description 新增一条支付流水交易记录
     * @author HanYiMing
     * @date 2024/3/20
     */
    @PostMapping("/pay/add")
    ResultData addPay(@RequestBody PayDTO payDTO);

    /**
     * 根据id获取支付流水记录
     *
     * @param id
     * @return
     */
//    @GetMapping("/pay/getById/{id}")
//    ResultData getById(@PathVariable("id") Integer id);

    /**
     * 测试feign负载均衡
     *
     * @return
     */
    @GetMapping("/pay/get/info")
    String mylb();

    /**
     * 根据id获取支付流水记录,断路器测试
     *
     * @param id
     * @return
     */
    @GetMapping("/pay/circuit/{id}")
    String myCircuit(@PathVariable("id") Integer id);
    /**
     * Resilience4j Bulkhead 的例子
     * @param id
     * @return
     */
    @GetMapping(value = "/pay/bulkhead/{id}")
    String myBulkhead(@PathVariable("id") Integer id);
    /**
     * Resilience4j Ratelimit 的例子
     * @param id
     * @return
     */
    @GetMapping(value = "/pay/ratelimit/{id}")
    String myRatelimit(@PathVariable("id") Integer id);

    /**
     * Micrometer(Sleuth)进行链路监控的例子
     * @param id
     * @return
     */
    @GetMapping(value = "/pay/micrometer/{id}")
    String myMicrometer(@PathVariable("id") Integer id);

    /**
     * GateWay进行网关测试案例01
     * @param id
     * @return
     */
    @GetMapping(value = "/pay/gateway/get/{id}")
    ResultData getById(@PathVariable("id") Integer id);

    /**
     * GateWay进行网关测试案例02
     * @return
     */
    @GetMapping(value = "/pay/gateway/info")
    ResultData<String> getGatewayInfo();


}
